Optimal Rectangle Packing: Initial Results

نویسنده

  • Richard E. Korf
چکیده

Given a set of rectangles with fixed orientations, we want to find an enclosing rectangle of minimum area that contains them all with no overlap. Many simple scheduling tasks can be modelled by this NP-complete problem. We use an anytime branch-and-bound algorithm to solve the problem optimally. Our main contributions are a lower-bound on the amount of wasted space in a partial solution, based on a relaxation of the problem to one-dimensional bin packing, and a dominance condition that allows us to ignore many partial solutions. For our experiments, we choose a class of increasingly difficult square-packing problems as a simple and easily-specified benchmark. The square-packing problem of size N is to find the smallest rectangle that contains the 1x1, 2x2, etc. up to NxN square. We find optimal solutions to these problems up to size N=22. For comparison, we also find the best slicing solutions, a popular approximation algorithm. Our approach is rather general, and many of our techniques can be applied to packing non-rectangular shapes in non-rectangular enclosing regions, and higher-dimensional packing problems as well. Introduction and Overview Consider the following very simple scheduling problem: We have a set of independent jobs, each of which requires a certain number of workers for a certain amount of time. We assume that the jobs are indivisible, meaning they can’t be broken down into smaller subtasks. If they can be decomposed, we break them down into their indivisible components, and then consider the components as jobs. All workers work the same hours, and are paid for their whole shift, whether they are busy or idle. We can adjust the number of workers, and the total amount of time. We’d like to minimize the total labor cost to complete all the jobs, which is proportional to the number of workers times the number of hours they are at work. Alternatively, we may want to complete all jobs as quickly as possible, using as many workers as necessary. As another alternative, we may want to minimize the number of workers, and complete all the jobs as soon as possible given that number of workers. A closely related problem is how to schedule a set of tasks that require a certain resource level, such as electric power on a spacecraft, for a given amount Copyright c © 2003, American Association for Artificial Intelligence (www.aaai.org). All rights reserved. of time, so that all tasks are completed as soon as possible without exceeding a maximum resource capacity. We can model these problems as rectangle-packing problems. Each job is represented by a rectangle, where one dimension is the number of workers needed, and the other is the amount of time required. The total number of workers is the height of an enclosing rectangle, and the length of time is the width. All the job rectangles must be packed into the enclosing rectangle, with no overlap. Minimizing the total labor cost amounts to finding the enclosing rectangle of minimum area that contains all the job rectangles. To minimize the number of workers, we want an enclosing rectangle of minimum width, whose height is the maximum number of workers needed for any job. Similarly, to minimize the amount of time, we want an enclosing rectangle of minimum height, whose width is the amount of time needed for the longest job. Of course, in reality there will be other constraints on the jobs, such as precedence constraints between jobs. Such constraints can be easily added to our solution algorithm, resulting in the pruning of partial solutions that don’t satisify the constraints. This pruning will make it easier to determine that a particular enclosing rectangle can’t contain all the job rectangles, but potentially more difficult to find a feasible solution within a particular enclosing rectangle. For simplicity, we consider the unconstrained case here, which is a subproblem of the more general case. Rectangle packing has other applications as well. In the design of VLSI chips, circuit blocks such as processors, memory, and I/O drivers must be assigned to physical regions of the chip. Another application is cutting a set of rectangles out of a single piece of stock material. A related problem is loading a set of rectangular objects onto a cargo pallet. An important difference between the scheduling problem described above and these other applications is that in the scheduling problem the orientation of the job rectangles is fixed, since workers and time are often not interchangeable. In VLSI design or cutting-stock problems, however, we can rotate our rectangles by ninety degrees. In this paper, we consider the fixed-orientation problem, and only briefly discuss the extension to unoriented rectangles. We focus here on optimal solutions, but develop an anytime algorithm. In other words, our algorithm finds an approximate solution immediately, and as it continues to run it ICAPS 2003 287 From: ICAPS-03 Proceedings. Copyright © 2003, AAAI (www.aaai.org). All rights reserved. finds better solutions, until it eventually finds and verifies an optimal solution. This eliminates solution quality as a variable in comparisons with other work. Furthermore, finding optimal solutions allows us to characterize the quality of approximate solutions. For example, we evaluate the quality of slicing solutions in our experiments. We first show that rectangle-packing problem is NPcomplete, and then briefly consider related work. We then consider how to pack a set of rectangles into an enclosing rectangle of fixed dimensions, using a branch-and-bound algorithm. In particular, we introduce a lower-bound on the amount of wasted space in a partial solution, based on a relaxation of the problem to one-dimensional bin packing. We also introduce a dominance condition that allows us to prune parts of the search space. We then show how to efficiently search the two-dimensional space of different enclosing rectangles to find one with the smallest area that will contain all the given rectangles. To test our algorithm, we we find the enclosing rectangle of smallest area that will contain a 1x1, 2x2, 3x3, etc., up to n × n square. We choose the special case of square packing because we can specify a set of increasingly difficult problem instances with just a single parameter n, making it easier for other researchers to compare their results to ours. Our algorithms, however, do not take advantage of the fact that our rectangles are squares, with one minor exception. We present optimal solutions for all problems up to size n = 22, and also the best of a class of approximate solutions. Finally, we conclude with further ideas to improve the performance of our algorithms and generalize our techniques. Rectangle Packing is NP-Complete The specific decision problem we consider in this section is given a set of rectangles with fixed orientation, and a specific enclosing rectangle, can all the given rectangles fit within the boundaries of the enclosing rectangle without any overlap? We show that this problem is NP-complete, by showing that the problem is in NP, and that it is NP-hard. It is clear that this problem can be solved in nondeterministic polynomial time. Given an assignment of the rectangles to positions within the enclosing rectangle, it is easy to check in polynomial time that no rectangle extends beyond the boundary of the enclosing rectangle, and that no two rectangles overlap. To show that rectangle packing is NP-hard, we demonstrate that bin packing can be reduced in polynomial time to rectangle packing. In other words, if rectangle packing can be solved in polynomial time, then so can bin packing. An instance of the bin-packing decision problem consists of a set of numbers, along with a fixed set of bins, each with the same fixed capacity. The problem is to assign each number to one of the bins, so that the sum of the numbers in each bin does not exceed the bin capacity. Bin packing is NPcomplete (Garey & Johnson 1979). Given an instance of bin packing, we can generate a corresponding instance of rectangle packing as follows. For each number in the bin-packing problem, we generate a rectangle of unit height whose width is the value of the number. Thus each number generates a strip of that width and unit height. We also generate an enclosing rectangle whose height is the number of bins, and whose width is the capacity of the bins. Thus each bin corresponds to a horizontal strip of the enclosing rectangle. In the resulting rectangle-packing problem, each strip must be assigned to a row (bin) of the enclosing rectangle, such that the sum of the widths (numbers) of the strips assigned to each row (bin) doesn’t exceed the width (bin capacity) of the enclosing rectangle. Note that the strips are oriented and cannot be rotated. Thus, this rectanglepacking problem is equivalent to the original bin-packing problem. If we can solve any rectangle-packing problem in polynomial time, then we can solve any bin-packing problem in polynomial time. Thus, rectangle packing is NP-hard, and since it is also in NP, it is NP-complete.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

A Novel Greedy Computing Algorithm for Rectangle Packing Problems

Rectangle packing problem often appears in encasement and cutting as well as layout of homepage or newspaper, etc. This problem has been shown to be NP hard. For solving this problem, many compute algorithms based on different strategies are presented in the literatures. A novel-computing algorithm is proposed in this paper. The novel match algorithm tested the instances that taken from the lit...

متن کامل

Optimal Rectangle Packing: A Meta-CSP Approach

We present a new approach to optimal rectangle packing, an NP-complete problem that can be used to model many simple scheduling tasks. Recent attempts at incorporating artificial intelligence search techniques to the problem of rectangle packing have focused on a CSP formulation, in which partial assignments are defined to be the fixed placement of a subset of rectangles. Our technique takes a ...

متن کامل

On Continuity Properties for Infinite Rectangle Packing

By rectangle packing we mean putting a set of rectangles into an enclosing rectangle, without any overlapping. We begin with perfect rectangle packing problems, then prove two continuity properties for parallel rectangle packing problems, and discuss how they might be used to obtain negative results for perfect rectangle packing problems.

متن کامل

Optimal rectangle packing

We consider the NP-complete problem of finding an enclosing rectangle of minimum area that will contain a given a set of rectangles. We present two different constraintsatisfaction formulations of this problem. The first searches a space of absolute placements of rectangles in the enclosing rectangle, while the other searches a space of relative placements between pairs of rectangles. Both appr...

متن کامل

Optimal Rectangle Packing: New Results

We present new results on the problem of finding an enclosing rectangle of minimum area that will contain a given a set of rectangles. Many simple scheduling tasks can be modelled by this NP-complete problem. We present a new lower bound on the amount of wasted space in a partial solution, a new dominance condition that prunes many partial solutions, and extend our algorithms to packing unorien...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2003